<?php
/*************************************************

标的主模型 - the 
Author: Reload <17-10-26>

*************************************************/
namespace Home\Model;
use Think\Model\RelationModel;
class PlatformObjectModel extends RelationModel {
    //查询多条数据
    public function get_all($map,$oredr=""){
        $data = $this->where($map)->field($field)->order($order)->select();
        return $data;
    }   

     //查询多条数据fenye 
    public function get_all_page($map,$page,$pagenum,$order=''){
        $data = $this->where($map)->order($order)->limit($page,$pagenum)->select();
        return $data;
    }    
    //查询单数据
    public function get_one($map){
        $data = $this->where($map)->find();
        return $data;
    }

    //更新
    public function edit($map,$data){
        $r = $this->where($map)->save($data);
        return $r;
    }

    //添加
    public function add($data){
        $data =M('PlatformObject')->data($data)->add();
        return $data;
    }


    //统计
    public function count($map){
        $count =M('PlatformObject')->where($map)->count();
        return $count;
    }

     //关联平台
    public function jion_platform($map='',$order='',$start='0',$end='999999999'){
        $field = "jg_platform_object.id,jg_platform_object.platform_id,jg_platform_object.name,jg_platform_object.actor,jg_platform_object.pic,jg_platform_object.invest,jg_platform_object.prize,jg_platform_object.extra,jg_platform_object.yields,jg_platform_object.allyields,jg_platform_object.deadline,jg_platform_object.active_id,jg_platform_object.add_time,jg_platform.background,jg_platform.land_page,jg_platform.property,jg_platform.img,jg_platform.start_amount,jg_platform.team,jg_platform.land_page";
        $data = M('PlatformObject')->join('jg_platform ON jg_platform_object.platform_id = jg_platform.id')->where($map)->order($order)->field($field)->limit($start,$end)->select();
        // echo  M('PlatformObject')->_sql();
        return $data;
    }
    

}